package cn.qiao.mdc.spring;

import org.springframework.aop.framework.ProxyFactory;

@SuppressWarnings("unchecked")
public class MDCProxyFactory {

    public static <T> T create(Object target) {
        ProxyFactory proxyFactory = new ProxyFactory();
        proxyFactory.setTarget(target);
        proxyFactory.addAdvice(new MDCInterceptor());
        return (T) proxyFactory.getProxy();
    }
}
